package eirkdbd.lab1.fuzzyqueries.helpers;

import java.util.Map;
import java.util.Map.Entry;

import eirkdbd.lab1.data.Team;

/**
 * Provides functionality to print bipolar query results in pretty format
 *
 */
public class BipolarQueriesResultsPrinter {
	
	/**
	 * Prints results in pretty format
	 * @param results - Map<Team, Double> -> Key : Team , Value : Membership Degree
	 * @param ommitZeros - indicates if records with 0 degree will be ommited
	 */
	static public void printResults(Map<Team, Double> results, boolean ommitZeros){
		String legend = String.format("%-10s\t%-20s\t%-3s\t%-3s\t%-3s\t%-3s\t%-3s\t%-3s\t%-3s\t%-3s\t%-3s\t%s"
				, "League", "Team", "g", "w", "l", "t", "g+", "g-", "g+/-", "pts", "rank", "md");
		System.out.println(legend);
		for (Entry<Team, Double> entry : results.entrySet()){
			if (ommitZeros)
				if (entry.getValue() <= 0)
					continue;
			System.out.println(entry.getKey().fullDescription() + "\t" + entry.getValue());
		}
		
	}
}
